<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>
This test checks that on a two finger tap gesture in a text area, the cursor is
first set to the right position.
</p>
<textarea id="text" rows="5" cols="31">
This test checks that on a two finger tap gesture in a text area, the cursor is
first set to the right position.
</textarea>
<div id="text">Testing</div>
<div id="result">FAIL</div>
<script>
function setCursorPosition(position)
{
    var text = document.getElementById("text");
    text.focus();
    text.setSelectionRange(position, position);
}

if (window.testRunner)
    testRunner.dumpAsText();

var text = document.getElementById("text");

setCursorPosition(0);

document.oncontextmenu = function() {
    if (text.selectionStart != 0)
        document.getElementById("result").innerHTML = "PASS";
}

var text = document.getElementById("text");

var x = text.offsetLeft + 10;
var y = text.offsetTop + 40;

if (window.eventSender) {
    if (eventSender.gestureTwoFingerTap)
        eventSender.gestureTwoFingerTap(x, y);
    else
        debug("gestureTwoFingerTap not implemented by this platform");
}
</script>
</body>
</html>
